<template>
  <div class="nav-bar">
    <div class="left" @click="goBack"><slot name="left"></slot></div>
    <div class="center"><slot></slot></div>
    <div class="right"><slot name="right"></slot></div>
  </div>
</template>

<script>
import {useRouter} from "vue-router";

export default {
  name: "navbar",
  setup(){
    const router = useRouter()
    const goBack = () => {
        router.go(-1)
    }
    return {
      goBack
    }
  }
}
</script>

<style scoped>
.nav-bar{
  background: var(--color-tint);
  color: #ffffff;
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  top: 0;
  z-index: 9;
  height: 45px;
  line-height: 45px;
  text-align: center;
  box-shadow: 0 2px 0px rgba(100, 100, 100, .1);
}
.left, .right {
  width: 60px;
}
.center{
flex: 1;
}
</style>